/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Objects;

import GameEngine.GameConstants.Effect;
import GameEngine.GameConstants.Graphic;
import GameEngine.GameConstants.Material;
import GameEngine.Vector;

/**
 *
 * @author jh20
 */
public class Ice extends GameObject {

    private Vector falseVelocity; // for when we transform into water

    /* constructor */
    public Ice(Vector dir, Vector cen, Vector s) {
        super(dir, cen, s, Graphic.ICE);
        material = Material.ICE;
        velocity = new Vector(0,0);
        acceleration = new Vector (0,0);
        isTangible = true;
        falseVelocity = new Vector(160, 80);
    }
    
    /**
     * "Copy" constructor
     * @param water
     */

    public Ice(Water water) {
        super(water.getDir(), water.getCenter(), water.getSize(), Graphic.ICE);
        material = Material.ICE;
        velocity = new Vector(0,0);
        acceleration = new Vector(0,0);
        isTangible = true;
        falseVelocity = water.getVelocity();
    }

    public Vector getFalseVel() {
        return falseVelocity;
    }

    @Override
    public void receiveEffect(Effect e, Vector d, int power) {
        // not affected by much
        switch (e) {
            case DESTROY:
                super.receiveEffect(e, d, power);
                break;
            case TRANSMUTE:
                Water water = new Water(this);
                lev.createObject(water);
                water.setCurrent(falseVelocity);
                this.receiveEffect(Effect.DESTROY, null, 0);
                break;
            default:
                // do nothing
                break;
        }
    }

    @Override
    public void collide(GameObject o) {
        // not much happens
    }

}
